ssh-keygen for github


TL;DR

ssh-keygen -t ed25519 -C "your_email@example.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/<private-key>

참고둜, μ € μœ„μ— 두 쀄을 $HOME/.bashrc νŒŒμΌμ— λ„£μœΌλ©΄ μž¬λΆ€νŒ…ν•΄λ„ μžλ™μœΌλ‘œ ssh agent에 λ“±λ‘λœλ‹€.

public keyλ₯Ό https://github.com/settings/keys 에 μΆ”κ°€ν•œλ‹€.

$HOME/.ssh/config νŒŒμΌμ„ μ—΄μ–΄ λ‹€μŒμ„ μΆ”κ°€ν•œλ‹€.

Host github.com
  HostName ssh.github.com
  User git
  PreferredAuthentications publickey
  IdentityFile "/path/to/private/key"
  AddKeysToAgent yes

λ‹€μŒ λͺ…λ Ήμ–΄λ₯Ό μ‹€ν–‰ν•˜μ—¬ publickey μ—λŸ¬κ°€ λ‚˜μ§€ μ•Šκ³  인삿말이 λ‚˜μ˜€λ©΄ OK

ssh -T git@github.com

πŸ†—

PTY allocation request failed on channel 0
Hi ChoiWheatley! You've successfully authenticated, but GitHub does not provide shell access.
Connection to ssh.github.com closed.

πŸ™…β€β™€οΈ

git@ssh.github.com: Permission denied (publickey).